<?php
namespace Admin\Controller;
use Think\Controller;
use Admin\Api\CarTermApi;
class CarTermController extends BaseController {
    /*
     * 电动车分类列表
     * */
    public function car_term_list(){
        $info = apiCall(CarTermApi::QUERY);
        if($info['status']){
            $this->assign('list',$info['info']['list']);
            $this->assign('show',$info['info']['show']);
        }
        $this->display();
    }

    /*
     * 增加电瓶车分类
     * */
    public function add_term(){
        if(IS_POST){
            $add = array(
                'term_name' => I('post.term_name'),
                'create_time' => time(),
                'update_time' => time(),
            );
            $res = apiCall(CarTermApi::ADD,array($add));
            if($res['status']){
                $this->success('添加成功',U('CarTerm/car_term_list'));
            }else{
                $this->error('添加失敗',U('CarTerm/car_term_list'));
            }
        }else{
            $this->display();
        }
    }

    /*
     *編輯
     * */
    public function edit_term(){
        $map['id'] = I('id');
        if(IS_POST){

        }else{
            $info =
            $this->display();
        }

    }
}